<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Array-practice</title>
</head>
<body>
<script>

    let list = [1, 2, 3, 4, 5, 6];
    // push(list, 7);
    // unshift(list, 0);
    // pop(list);
    // shift(list);
    // splice(list, 1, 2, 666, 888);
    // slice(list,  2);
    // concat(list, [7,8,9]);
    // reverse(list);
    // sort(list);
    // join(list);
    // toString(list);
    // indexOf(list);
    // lastIndexOf(list);
    // includes(list, 2);

    function push() {
        list.push(7);
        console.log(list);
    }

    function unshift() {
        list.unshift(0);
        console.log(list);
    }

    function pop() {
        let result = list.pop();
        console.log(result);
        console.log(list);
    }

    function shift() {
        let result = list.shift();
        console.log(result);
        console.log(list);
    }

    function splice() {
        let result = list.splice(1, 2, 666, 888);
        console.log(result);
        console.log(list);
    }

    function slice() {
        let result = list.slice(2);
        console.log(result);
        console.log(list);
    }

    function concat() {
        let result = list.concat(7, 8, 9);
        console.log(result);
        console.log(list)
    }

    function reverse() {
        let result = list.reverse();
        console.log(result);
        console.log(list)
    }

    function sort() {
        let result = list.sort();
        console.log(result);
        console.log(list)
    }

    function join() {
        let result = list.join("-");
        console.log(result);
        console.log(list)
    }

    function toString() {
        let result = list.toString();
        console.log(result);
        console.log(list)
    }

    function indexOf() {
        let result = list.indexOf(4);
        console.log(result);
        console.log(list)
    }

    function lastIndexOf() {
        let result = list.lastIndexOf(3);
        console.log(result);
        console.log(list)
    }

    function includes() {
        let result = list.includes(7);
        console.log(result);
        console.log(list)
    }


</script>
</body>
</html>